import {BrowserModule} from '@angular/platform-browser';
import {NgModule} from '@angular/core';
import {RouterModule} from '@angular/router';

import {S3UploaderModule} from 'ngx-s3-upload';

import {NormalService} from '../../apiServices/normal.service';

import {PaginationModule} from 'ngx-bootstrap/pagination';
import {CommonModule} from '@angular/common';
import {FormsModule} from '@angular/forms';
import {BsDropdownModule, CollapseModule, ModalModule} from 'ngx-bootstrap';

import {AccountComponent} from './account/account.component';
import {SecurityComponent} from './security/security.component';
import {RealAuthenticationComponent} from './real-authentication/real-authentication.component';
import {ModifyPasswordComponent} from './modify-password/modify-password.component';
import {OrderComponent} from './order/order.component';
import {ExchangeVoucherComponent} from './exchange-voucher/exchange-voucher.component';
import {TransferComponent} from './transfer/transfer.component';
import {PayPasswordComponent} from './pay-password/pay-password.component';
import {TransferHistory} from './transfer-history/transfer-history.component';
import {PermissionGuard} from '../permission/permission-guard';

@NgModule({
    declarations: [
        AccountComponent,
        SecurityComponent,
        RealAuthenticationComponent,
        ModifyPasswordComponent,
        OrderComponent,
        ExchangeVoucherComponent,
        TransferComponent,
        PayPasswordComponent,
        TransferHistory
    ],
    imports: [
        RouterModule.forChild([
            {
                path: '', component: AccountComponent, canActivate: [PermissionGuard], canActivateChild: [PermissionGuard], children: [

                    {path: '', redirectTo: 'security', pathMatch: 'full'},
                    {path: 'security', component: SecurityComponent},
                    {path: 'authentication', component: RealAuthenticationComponent},
                    {path: 'modify', component: ModifyPasswordComponent},
                    {path: 'order', component: OrderComponent},
                    {path: 'voucher', component: ExchangeVoucherComponent},
                    {path: 'transfer', component: TransferComponent},
                    {path: 'pay-password', component: PayPasswordComponent},
                    {path: 'transferHistory', component: TransferHistory},
                ]
            }
        ]),
        ModalModule.forRoot(),
        BsDropdownModule.forRoot(),
        CollapseModule.forRoot(),
        CommonModule,
        FormsModule,
        PaginationModule.forRoot(),
        S3UploaderModule.forRoot({
            region: 'ap-northeast-2',
            bucket: 'wakandacar/realname',
            credentials: {accessKeyId: 'AKIAJGHKAM7YCDAKZS7A', secretAccessKey: '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'},
        })
    ],
    providers: [NormalService],
})
export class AccountModule {

}
